<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld"  prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld"  prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>

<%@ page  import="java.util.*" %>
<%@ page  import="com.erp.framework.util.CommonUtil" %>
<%@ page  import="com.erp.app.common.ProjectConstants" %>

<jsp:useBean id="remarkTextForm" scope="session" type="com.erp.common.web.RemarkTextForm" />
<% 	HashMap params = remarkTextForm.getParams();
	boolean readonly = !CommonUtil.isEmpty(params.get(ProjectConstants.SESSION_SIMPLE_READ_ONLY));
%>

<head>
<title>Remark Input</title>
<link rel="stylesheet" href="<%=request.getContextPath()+ "/css/style.css" %>" type="text/css">

<script language="javascript">
<!--
var isSubmitted = 0;
 
function doSubmit(event) {
    document.forms[0].pageEvent.value = event;
    isSubmitted = 1;
    document.forms[0].submit();
}

function doLoad() {
	<% 
	if (!CommonUtil.isEmpty(remarkTextForm.getPageEvent())) {
		if (remarkTextForm.getPageEvent().equals("ok")) {
			out.println("window.opener.doSubmit('doNothing');");
		}
		out.println("self.close();");
	}
	%>
	window.resizeTo(750, 550);
	window.moveTo(0, 0);
}
-->
</script>
</head>
<body onLoad="javascript:doLoad();" bgcolor="#ffffff">

<html:form action="/remarkText">
<html:hidden property="pageEvent" />
<html:hidden property="pageMode" />

<table bgcolor="#E0E6E7" border=1 bordercolor="#C1C1C1" cellpadding=0 cellspacing=0 width=100%>
<% 
    LinkedList keyList = (LinkedList) params.get(ProjectConstants.SESSION_KEY_LIST);
	if(keyList != null){
		Iterator iterator = keyList.iterator();
		while (iterator.hasNext()) {
			String key = (String) iterator.next();

			String value = "";
			if(iterator.hasNext()){
				value = (String) iterator.next();
			}
	%>
	<tr valign="top">
		<td class="col_label"><%= key %>:</td>
		<td class="t2"><%= value %></td>
	</tr>
<% 
		}
	}
%>

<tr valign="top">
    <td class="col_label"></td>
    <td class="col_value">
    <%	if (!readonly) { %>
        <input name="btn_ok" type="button" value="  OK  " onClick="javascript:doSubmit('ok');" class="button1">
	<%	} %>        
		<input name="btn_cancel" type="button" value="Cancel" onClick="javascript:doSubmit('cancel');" class="button1" >
    </td>
</tr>
<tr valign="top">
     <td class="col_label"><bean:write name="remarkTextForm" property="remarkColumnName" filter="true"/>:</td>
     <td class="col_value">
    <% 	if (!readonly) { %>
       	<html:textarea property="remarkText" rows="30" cols="80" styleClass="t2" />
    <% 	} else { %>
       	<html:textarea property="remarkText" rows="30" cols="80" styleClass="t2" readonly="<%=readonly%>"/>    	
	<% 	} %>
   	</td>
</tr>

</table>
</html:form>
</body>
